#pragma once

#ifndef _ParticleEmitter_h_
#define _ParticleEmitter_h_

#include "Particle.h"
#include "ParticleSystem.h"
#include "../../Framework/Quad.h"
#include "../../Framework/GameComponent.h"

namespace MyGame {

using namespace Framework;
using namespace std;

class ParticleEmitter :
            public GameComponent {
public:
    ParticleEmitter(Game* game);
    ~ParticleEmitter(void);
    D3DXVECTOR3 GetBeginScale() const;
    void SetBeginScale(D3DXVECTOR3 val);
    Quad* GetEffect() const;
    void SetEffect(Quad* val);
    D3DXVECTOR3 GetEndScale() const;
    void SetEndScale(D3DXVECTOR3 val);
    D3DXVECTOR3 GetGravity() const;
    void SetGravity(D3DXVECTOR3 val);
    FLOAT GetParticleLife() const;
    void SetParticleLife(FLOAT val);
    ParticleSystem* GetParticleSystem() const;
    void SetParticleSystem(ParticleSystem* val);
    FLOAT GetPeriod() const;
    void SetPeriod(FLOAT val);
    D3DXVECTOR3 GetPosition() const;
    void SetPosition(D3DXVECTOR3 val);
    D3DXVECTOR3 GetSpeed() const;
    void SetSpeed(D3DXVECTOR3 val);
    virtual void Emit();
    virtual void Update(FLOAT timeDelta);
private:
    D3DXVECTOR3 beginScale;
    Quad* effect;
    D3DXVECTOR3 endScale;
    int generatedParticles;
    D3DXVECTOR3 gravity;
    D3DXVECTOR3 lastParticlePosition;
    FLOAT particleLife;
    ParticleSystem* particleSystem;
    D3DXVECTOR3 position;
    D3DXVECTOR3 prevPosition;
    FLOAT period;
    D3DXVECTOR3 speed;
    FLOAT timer;
};

}

#endif
